package edu.tju.trainEquipment;

import java.sql.SQLException;

import java.util.List;

import com.ibatis.sqlmap.client.SqlMapClient;
import com.younker.waf.db.IBatisConfig;


public class IbatisTrainEquipmentDao implements ITrainEquipmentDao{
	protected SqlMapClient sqlMap = IBatisConfig.getSqlMapInstance();


	@SuppressWarnings("unchecked")
	public List<TrainEquipment> getTrainEquipmentAnd(
			TrainEquipment trainEquipment) throws SQLException {
		return sqlMap.queryForList("getTrainEquipmentAnd", trainEquipment);
	}
	public TrainEquipment getTrainEquipmentById(long id) throws SQLException {
		return (TrainEquipment) sqlMap.queryForObject("getTrainEquipmentById", id);
	}
	public List<TrainEquipment> getTrainEquipmentOr(TrainEquipment car)
			throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}
	public Long insertTrainEquipment(TrainEquipment trainEquipment)
			throws SQLException {
		return (Long)sqlMap.insert("insertTrainEquipment", trainEquipment);
	}
	public int updateTrainEquipment(TrainEquipment trainEquipment)
			throws SQLException {
		return sqlMap.update("updateTrainEquipment",trainEquipment);
	}
	public void deleteTrainEquipment(long id) throws SQLException {
		sqlMap.delete("deleteTrainEquipment", id);
	}
}
